﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TalentRecruitmentSystem.Service;
using TalentRecruitmentSystem.Manage;

namespace TalentRecruitmentSystem.Pages
{
    public partial class PersonalRigister : System.Web.UI.Page
    {
        UserInfoManage um = new UserInfoManage();
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void IbtnLogin_Click(object sender, ImageClickEventArgs e)
        {
            UserInfo userinfo = new UserInfo();
            if (Cbox_agreement1.Checked = true)
            {
                if (txtUserName.Text != "" && txtPwd.Text != "" && txtPwd2.Text != "")
                {
                    if (txtPwd.Text == txtPwd2.Text)
                    {
                        userinfo.UserName = txtUserName.Text;
                        userinfo.Password = txtPwd.Text;
                        #region
                        //userinfo.TruthName = txtName.Text;
                        //userinfo.SelfNumber = txtNo.Text;
                        //userinfo.Phone = txtMobleNo.Text;
                        //userinfo.QQ = int.Parse(txtQQ.Text);
                        //userinfo.Email = txtEmail.Text;
                        //userinfo.Role = "普通用户";
                        //if (RadioM.Checked = true)
                        //{
                        //    userinfo.Gender = "男";
                        //}
                        //else
                        //    userinfo.Gender = "女";
                        #endregion
                        userinfo.Role = "普通用户";
                        um.Add(userinfo);
                        Response.Write("<script>window.alert('操作成功！');</script>");
                        Response.Redirect("Home.aspx?Name=" + userinfo.UserName);
                    }
                    else
                    {
                        Response.Write("<script>window.alert('2次输入的密码不相等！');</script>");
                        txtPwd.Text = "";
                        txtPwd2.Text = "";
                    }

                }
                else
                    Response.Write("<script>window.alert('用户名和密码不能为空！');</script>");
            }
            else
            {
                Response.Write("<script>window.alert('你需要同意注册条款才能注册！');</script>");
            }
        }
    }
}